const express = require('express');
const { routeWrapper } = require('../../../lib/module/tool/route');
const router = express.Router();

const categoryService = require('../../../lib/service/categoryService');

const Client = require('../../../lib/module/const/Client');

// 分类列表
router.get('/:areaId/categoryList', routeWrapper(async (req) => {
    return categoryService.categoryList(Client.MiniProgram, req.params.areaId);
}, true));

// 通过子分类查询产品对应关系
router.post('/:areaId/product', routeWrapper(async (req) => {
    return categoryService.correspondingProduct(req.params.areaId, req.body.mainCategoryId, req.body.subCategoryId);
}, true));
module.exports = router;
